import {createRouter, createWebHistory} from 'vue-router'

const routes = [
  {
    path: '/',
    component: () => import('../layouts/MainLayout.vue'),
    children: [
      {
        path: '/',
        name: 'Home',
        component: () => import('../views/home/index.vue'),
        meta: {showHeader: true}
      },



      {
        path: '/myView',
        name: 'myView',
        component: () => import('../views/myView/index.vue'),
        meta: {showHeader: true}
      },
      {
        path: '/dashboard',
        name: 'dashboard',
        component: () => import('../views/dashboard/index.vue'),
        meta: {showHeader: true}
      },
      {
        path: '/dashboards',
        name: 'dashboards',
        component: () => import('../views/dashboards/index.vue'),
        meta: {showHeader: true}
      },

      // 示例：不显示头部的路由
      {
        path: '/login',
        name: 'Login',
        component: () => import('../views/error/404.vue'), // 使用已有的404页面作为示例
        meta: {showHeader: false}
      },

      // 添加明确的404路由路径
      {
        path: '/404',
        name: 'NotFound404',
        component: () => import('../views/error/404.vue'),
        meta: {showHeader: false}
      }
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import('../views/error/404.vue')
  }
]

const router = createRouter({
  history: createWebHistory('/smartschool/work/'),
  routes
})

export default router
